<?php
add_filter('query_vars','dynamic_vars');
function dynamic_vars($vars) {
    $vars[] = 'dynamic';
    return $vars;
}

add_action('template_redirect', 'dynamic_check');
function dynamic_check() {
	$get_val = get_query_var('dynamic');
	
	if($get_val == "css") {
?>
<?php 
	header('Content-type: text/css');
?>
/* getting main menu styles */
.overallmenu{
	font: bold <?php echo get_option("main_menu_size", "17"); ?>px "<?php echo get_option("main_menu_face", "Trebuchet MS"); ?>";
	margin-top:<?php echo get_option("main_menu_container_pad", "50"); ?>px;
}

.overallmenu ul li a{	
	color: <?php echo get_option('main_menu_color', '#385064'); ?>;	
}

.overallmenu ul li {			
	display: block;	
	padding:10px <?php echo get_option('main_menu_between', '15'); ?>px 10px 10px;	
}

.portfolio_filter ul li.current_page_item{
	background-color:<?php echo get_option('main_menu_over_color', '#6796af'); ?>;
}
.overallmenu ul li.current_page_item a,
.overallmenu ul li.current-menu-item a,
.overallmenu ul li.current-menu-ancestor a,
.overallmenu ul li.current_page_ancestor a,
.overallmenu ul li a:hover{
	color: <?php echo get_option('main_menu_over_color', '#6796af'); ?>;
}

.overallmenu ul.children li a,
.overallmenu ul.children li ul.children li a,
.overallmenu ul.children li ul.children li ul.children li a,
.overallmenu ul.sub-menu li a,
.overallmenu ul.sub-menu li ul.sub-menu li a,
.overallmenu ul.sub-menu li ul.sub-menu li ul.sub-menu li a{
	color: <?php echo get_option('sub_menu_color', '#ffffff'); ?>;
}

.overallmenu ul.children li a:hover,
.overallmenu ul.sub-menu li ul.sub-menu li ul.sub-menu li a:hover,
.overallmenu ul.children li ul.children li ul.children li a:hover,
.overallmenu ul.children li ul.children li a:hover,
.overallmenu ul.sub-menu li a:hover,
.overallmenu ul.sub-menu li ul.sub-menu li a:hover{
	color: <?php echo get_option('sub_menu_over_color', '#6796af'); ?>;
}

.overallmenu ul.sub-menu li.current-menu-ancestor a,
.overallmenu ul.sub-menu li.current-menu-item a,
.overallmenu ul.sub-menu li.current_page_item a,
.overallmenu ul.sub-menu li ul.sub-menu li.current-menu-ancestor a,
.overallmenu ul.sub-menu li ul.sub-menu li.current-menu-item a,
.overallmenu ul.sub-menu li ul.sub-menu li.current_page_item a,
.overallmenu ul.sub-menu li ul.sub-menu li ul.sub-menu li.current-menu-ancestor a,
.overallmenu ul.sub-menu li ul.sub-menu li ul.sub-menu li.current-menu-item a,
.overallmenu ul.sub-menu li ul.sub-menu li ul.sub-menu li.current_page_item a,
.overallmenu ul.children li.current_page_item a,
.overallmenu ul.children li.current_page_ancestor a,
.overallmenu ul.children li ul.children li.current_page_ancestor a,
.overallmenu ul.children li ul.children li.current_page_item a,
.overallmenu ul.children li ul.children li ul.children li.current_page_ancestor a,
.overallmenu ul.children li ul.children li ul.children li.current_page_item a,
.overallmenu ul.children li a:hover{
	color: <?php echo get_option('sub_menu_over_color', '#6796af'); ?>;
}

.overallmenu ul li ul li a{
	font: <?php echo get_option('sub_menu_size', '12'); ?>px <?php echo get_option('sub_menu_face', 'Verdana'); ?>;
	color: <?php echo get_option('sub_menu_color', '#ffffff'); ?>;
	/*text-shadow: 1px 1px <?php echo get_option('sub_menu_text_shadow', '#000000'); ?>;*/
	width: 165px; 	
	line-height:21px;
}

.overallmenu ul li ul li ul li a{
	width: 168px; 	
}
.overallmenu ul li ul li ul li {
	width: 188px; 	
}

.overallmenu ul li ul li a:hover{
	background-color: <?php echo get_option('sub_menu_over_back_color', '#161e26'); ?>;
}

/* getting site logo styles */
.header_logo{	margin-top:<?php echo get_option('logo_pad', '10'); ?>px;	}

/* getting fade slider styles */
.slider_content{
	background:none;
	display:table;
}

.slider_full{
	height:<?php echo get_option('fade_slider_height', '300')+(get_option('fade_slider_border', '10')*2); ?>px;
}

<?php 
	$stype = get_option('home_slider_type', 'Fade');
		if($stype == "Fade"){
	?>
.banner_model_1{		min-height:<?php echo get_option('fade_slider_height', '300')+20; ?>px;	}
.slider_default{		height:<?php echo get_option('fade_slider_height', '300')+20; ?>px;	}
<?php } ?>
.slider_simple_image, .slider_center_image img {	border:<?php echo get_option('fade_slider_border', '10'); ?>px solid <?php echo get_option('fade_slider_border_color', '#ffffff'); ?>;	}
.slider_left_image,
.slider_right_image	{
	width:<?php echo get_option('fade_slider_width1and2', '670'); ?>px;
	height:<?php echo get_option('fade_slider_height', '300'); ?>px;
	background-color:<?php echo get_option('fade_slider_border_color', '#ffffff'); ?>;
	background-position:<?php echo get_option('fade_slider_width1and2', '670')/2 - 16; ?>px <?php echo get_option('fade_slider_height', '300')/2 - 16; ?>px;
	background-repeat:no-repeat;
	border:<?php echo get_option('fade_slider_border', '10'); ?>px solid <?php echo get_option('fade_slider_border_color', '#ffffff'); ?>;
}

.slider_left_image img,
.slider_right_image	img{
	width:<?php echo get_option('fade_slider_width1and2', '670'); ?>px;
	height:<?php echo get_option('fade_slider_height', '300'); ?>px;
}

.slider_text .textspan,
.slider_text_full .textspan{
	font-size:<?php echo get_option('fade_slider_description_size', '12'); ?>px;
	color:<?php echo get_option('fade_slider_desc_color', '#ffffff'); ?>;
}

.slider_text h2,
.slider_text_full h2{
	font-size:<?php echo get_option('fade_slider_title_size', '28'); ?>px;
	color:<?php echo get_option('fade_slider_title_color', '#ffffff'); ?>;
}

.slider_text{
	width:<?php echo 940 - get_option('fade_slider_width1and2', '670') - (get_option('fade_slider_border', '10')*2); ?>px;
	/*min-height:<?php echo get_option('fade_slider_height', '300')-75; ?>px;*/
}
.noborder{
	/*min-height:<?php echo get_option('fade_slider_height', '300')-95; ?>px;*/
}

.slider_border,
.slider_border img {			border:none;	}


/* getting nivo slider styles */
<?php
	$stype = get_option('home_slider_type', 'Fade');
	if($stype == "Nivo"){ 
?>
.ntitle {  
	font-size:<?php echo get_option('nivo_slider_title_size', '24'); ?>px;
	background:<?php echo get_option('nivo_slider_border_color', '#ffffff'); ?>;
	color:<?php echo get_option('nivo_slider_title_color', '#555555'); ?>;
}

.ndescription {  
	font-size:<?php echo get_option('nivo_slider_description_size', '12'); ?>px;
	color:<?php echo get_option('nivo_slider_desc_color', '#ffffff'); ?>;
}

.hide_desc { 					
	position:absolute; z-index:50;  
	margin-top:-<?php if(get_option('nivo_slider_borderon', 'on') == "on"){ $sn = 40; } else { $sn = 30; } echo $sn+get_option('nivo_slider_border', '10')+get_option('nivo_slider_title_size', '24')+get_option('nivo_slider_description_size', '12'); ?>px; 
	margin-left:<?php echo (960-get_option('nivo_slider_width', '940'))/2; ?>px; color:#000;  
}

#sliderNivo {					
	width:<?php echo get_option('nivo_slider_width', '940'); ?>px;	
	height:<?php echo get_option('nivo_slider_height', '300'); ?>px; 
	<?php if(get_option('nivo_slider_borderon', 'on') == "on"){?>	
	border:<?php echo get_option('nivo_slider_border', '10'); ?>px solid <?php echo get_option('nivo_slider_border_color', '#ffffff'); ?>;
	<?php } ?>
	margin-left:auto;
	margin-right:auto;
}

<?php
	
	global $wpdb;
	$db_name = "nivo_slider";
	include (TEMPLATEPATH . '/framework/includes/get_'.$db_name.'_db.php');

	$slider_datas = $wpdb->get_results("SELECT * FROM $table_name ORDER BY orderby");
	$s=0;
	foreach ($slider_datas as $data){	$s++;	}
		
	if ($s < 1 or $s == 1){
?>
.banner_model_1{		height:<?php echo get_option('nivo_slider_height', '300')+20; ?>px;	}
.nivo-controlNav,
.nivo-directionNav a {	display:none;	}
<?php }	if ($s > 1){ ?>
.banner_model_1	{		height:<?php echo get_option('nivo_slider_height', '300')+60; ?>px;	}
<?php } ?>

.nivo-controlNav {				
	left:<?php echo (get_option('nivo_slider_width', '940')/2) - (($s * 31)/2); ?>px;
}
<?php if(get_option('nivo_slider_circles', 'on') == "off"){ ?>
.nivo-controlNav{	display:none;	}
.banner_model_1{		height:<?php echo get_option('nivo_slider_height', '300')+20; ?>px;	}
<?php } ?>
<?php if(get_option('nivo_slider_arrows', 'on') == "off"){ ?>
.nivo-directionNav a {	display:none;	}
<?php } ?>

<?php } ?>


<?php 
$ztype = get_option('home_slider_type', 'Fade');
	if($ztype == "3D"){
?>
.slider_default{		height:320px;	}
<?php } ?>

.intro_text{
	font-size:<?php echo get_option('home_intro_text_size', '20'); ?>px;
}

.intro_image{
	font-size:<?php echo get_option('get_in_touch_size', '20'); ?>px;
}

.home_widget_content{
	font-size:<?php echo get_option('widgets_content_size', 13); ?>px;
	color:<?php echo get_option('widgets_content_color', '#555555'); ?>;
}

.home_widget_content h3{
	font-size:<?php echo get_option('widgets_title_size', 22); ?>px;
	color:<?php echo get_option('widgets_title_color', '#555555'); ?>;
	letter-spacing:0.4px;
	line-height:27px;
}

.twt_container{
	font-size:<?php echo get_option('twitter_font_size', 17); ?>px;
}
	<?php
		exit;
	}	
	
	if($get_val == "js") {
	header('Content-type: text/javascript');
	
	?>
/* get site url */
$site_url = "<?php bloginfo('template_url'); ?>";

/* get cufon active */
$cufon_active = "<?php echo get_option('cufon_active', 1); ?>";

/* getting fade slider settings */
<?php if(get_option('fade_slider_auto_play', 'on') == "on"){	$output_fspeed = get_option('fade_slider_speed', '5')."000";	}	else	{	$output_fspeed = "false";	}	?>
$fade_slider_speed = <?php echo $output_fspeed; ?>;

/* getting nivo slider settings */
<?php if(get_option('nivo_slider_auto_play', 'on') == "on"){	$output_nspeed = get_option('nivo_slider_speed', '5')."000";	}	else	{	$output_nspeed = "900000";	}	?>
$nivo_slider_speed = <?php echo $output_nspeed; ?>;
$nivo_slider_effect = '<?php echo get_option('nivo_slider_effect', 'random'); ?>';

/* getting headlines settings */
<?php if(get_option('headlines_delay', '5') != "0"){	$output_hspeed = get_option('headlines_delay', '5')."000";	}	else	{	$output_hspeed = "900000";	}	?>
$headlines_delay = <?php echo $output_hspeed; ?>;


/* gettings menu colors */
$main_menu_color = "<?php echo get_option('main_menu_color', '#385064'); ?>";
$main_menu_over_color = "<?php echo get_option('main_menu_over_color', '#6796af'); ?>";		


$twitter_id = "<?php echo get_option('twitter_id', 'ThemeForest'); ?>";		
$twitter_limit = "<?php echo get_option('twitter_limit', '5'); ?>";		
	<?php
		exit;
	}
	
	if($get_val == "sitemail") {
		echo get_option('site_form_email', 'info@codestarlive.com');
		exit;
	}
}
